home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / util / pack / xpk_Develop.lha / xpk_Develop / Include / Modula2 / XpkPrefs.def < prev    next >
Encoding:
Modula Definition  |  1998-11-09  |  4.4 KB  |  124 lines

  1. (*#-- BEGIN AutoRevision header, please do NOT edit!
  2. *
  3. * $VER: XpkPrefs.def 1.3 (11.06.1998)
  4. * Auth: T.B. <tonyiommi@geocities.com>
  5. *
  6. * Desc: This module you will need, if you want to write your own preferences system.
  7. * Reqs: AMIGA OS 2.0
  8. * Lang: MODULA-2
  9. * Comp: Cyclone © by M. Timmermans
  10. *
  11. *-- END AutoRevision header --*)
  12.  
  13. DEFINITION MODULE XpkPrefs; (*$ Implementation- *)
  14.  
  15. FROM SYSTEM IMPORT ADDRESS,CAST,LONGSET;
  16. FROM ExecD IMPORT SignalSemaphore,TaskPtr;
  17. FROM UtilityD IMPORT HookPtr,TagItemPtr;
  18.  
  19. TYPE StrPtr = ADDRESS;
  20.  
  21. CONST
  22.  xpkT = CAST(LONGINT,"XPKT");
  23.  xpkM = CAST(LONGINT,"XPKM");
  24.  
  25. (* --- XpkTypeData structure --- *)
  26.  tdNoPack      = 1;     (* filetype should not be crunched *)
  27.  tdReturnError = 2;     (* return error errNoMethod *)
  28. (* These two cannot be set same time! *)
  29.  
  30. TYPE
  31.  TypeDataPtr=POINTER TO TypeData;
  32.  TypeData=RECORD
  33.   flags     :LONGSET;       (* see above td flags *)
  34.   stdID,                    (* holding the ID --> 'NUKE *)
  35.   chunkSize :LONGINT;       (* maybe useless with external crunchers *)
  36.   mode,                     (* PackMode *)
  37.   version   :INTEGER;       (* structure version --> 0 at the moment *)
  38.   password,                 (* not used at the moment *)
  39.   memory    :StrPtr;        (* memory pointer - when should be freed by *)
  40.   memorySize:LONGINT;       (* memory size    - receiver (xpkmaster) *)
  41.  END;
  42.  
  43. (* --- XpkTypePrefs structure --- *)
  44. CONST
  45.  tpNamePattern = 1;  (* File Pattern is given *)
  46.  tpFilePattern = 2;  (* Name Pattern is given *)
  47. (* These can both be set (in loading this means File AND Name Pattern have to match), but one is needed *)
  48.  
  49. TYPE
  50.  TypePrefsPtr=POINTER TO TypePrefs;
  51.  TypePrefs=RECORD
  52.   flags        :LONGSET;        (* See above tp Flags *)
  53.   typeName,                     (* Name of this file type (for prefs program) *)
  54.   namePattern,                  (* Pointer to NamePattern *)
  55.   filePattern  :StrPtr;         (* Pointer to FilePattern *)
  56.   packerData   :TypeDataPtr;
  57.  END;
  58.  
  59. (* --- XpkMainPrefs structure --- *)
  60. CONST
  61.  mpUseXFD         = 1;  (* Use xfdmaster.library for unpacking *)
  62.  mpUseExternals   = 2;  (* Use xex libraries *)
  63.  mpAutoPassword   = 4;  (* Use the automatic password requester *)
  64.  
  65. TYPE
  66.  MainPrefsPtr=POINTER TO MainPrefs;
  67.  MainPrefs=RECORD
  68.   version,                      (* version of structure ==> 0 *)
  69.   flags         :LONGSET;       (* above defined mp flags *)
  70.   defaultType   :TypeDataPtr;   (* sets the mode used as default *)
  71.   timeout       :INTEGER;       (* Timeout for password requester given in seconds, zero means no timeout *)
  72.  END;
  73.  
  74. (*
  75. The library internal defaults are:
  76.   mpUseXFD           FALSE
  77.   mpAutoPassword     FALSE
  78.   mpUseExternals     TRUE
  79.   mpReturnError      defined as default
  80.   mpTimeOut          set to 120  (two minutes)
  81.  
  82. These defaults are used, when no preferences file is given.
  83. *)
  84.  
  85. (* --- XpkMasterPrefs Semaphore structure ---
  86.  *
  87.  *  find with FindSemaphore(PrefsSemName);
  88.  *
  89.  *  obtain with ObtainSemaphoreShared(),
  90.  *  programs WRITING into the structure fields must know:
  91.  *  - use ObtainSemaphore() instead of ObtainSemaphoreShared()
  92.  *  - free memory of elements you remove
  93.  *  - xb_MainPrefsSize is the length of memory allocated for xb_MainPrefs
  94.  *  - all other nodes are freed, when XpkMasterPrefs program finishes, do
  95.  *  not do it your own, but you have to allocate memory for new ones!
  96.  *  Generally there should be no need to write to these fields !!!!
  97.  *)
  98.  
  99. CONST
  100.  prefsSemName  = "« XPKMasterPrefs »";
  101.  
  102. (* Defines used for xps_PrefsType. These help to find out, which preferences type is used. *)
  103.  pefsTypeStandard = CAST(LONGINT,"XPKM");
  104.  prefsTypeCYB     = CAST(LONGINT," CYB");
  105.  
  106. TYPE
  107.  PrefsSemaphorePtr=POINTER TO PrefsSemaphore;
  108.  PrefsSemaphore=RECORD
  109.   semaphore    :SignalSemaphore;
  110.   version      :LONGINT;        (* at the moment 0 *)
  111.   prefsType    :LONGINT;        (* preferences type *)
  112.   prefsData    :ADDRESS;        (* preferences data *)
  113.   mainPrefs    :MainPrefsPtr;   (* defined defaults *)
  114.   recogSize    :LONGINT;        (* needed size of Recogbuffer *)
  115.   //PROCEDURE recogFunc(buffer{8},fileName{9}:StrPtr; bufferSize{0},fullSize{1}:LONGINT; tags{10}:TagItemPtr):TypeDataPtr;
  116.   recogFunc    :POINTER TO PROCEDURE(StrPtr,StrPtr,LONGINT,LONGINT,TagItemPtr):TypeDataPtr;
  117.   progressHook :HookPtr;        (* hook function *)
  118.   masterTask   :TaskPtr;        (* Creater's task *)
  119.  END;
  120.  
  121. (* Use Signal(sem^.psMasterTask, DosD.ctrlC); to get the installer program to remove the semaphore. *)
  122.  
  123. END XpkPrefs.
  124.